/**
 * @param {string[]} strs
 * @return {string}
 */
var longestCommonPrefix = function (strs) {
    if(strs[0]==''){
        return ''
    }
    if(strs.length==1){
        return strs[0]
    }
    let result = '';
    let currentCheckIndex = 0;
    let currentChar;
    while (currentChar!=''){
        currentChar = strs[0][currentCheckIndex];
        if(currentChar==undefined){
            return result
        }
        for (let i = 0; i < strs.length; i++) {
            if (strs[i][currentCheckIndex] != currentChar) {
                return result
            }
        }
        result+=currentChar;
        currentCheckIndex++;
    }
    return result
};